Code Portfolio
Ari Wilson
Computer Graphics Code

This program was written in C++ over the course of a semester to demonstrate various facets of graphics as we discussed them in class. It has the ability to arbitrarily resize and filter TIFF images according to various basic kernels. It also can perform matrix transformations on 3D primitives to produce basic scene rendering. Finally, it can produce raytraced images from 3D primitives to produce semi-realistic (if slow) renders. It can take input on its own command prompt or can be fed scripts from files. Some examples of the images it can produce and the commands used to produce them are given here (*.cli files are scripts, *.tif are input files, *.png are output files).

As it was written during extremely busy semester at the beginning of my sophomore year, code organization is a bit lacking in this project (most code is contained in main.cpp). However, it is still the longest single project I have wholly written so far (over 4,000 lines) and, I believe, one that is interesting enough to be put into this portfolio.

The original readme created for this project follows:

This project was created by Ari Wilson, for CS258, on 12/7/05, as his submission for assignment 5. It is entirely my own work, as pursuant to the Vanderbilt Honor Code.

The following are notes about the CLI:
1) In a script, the last functional line must be followed by a carriage return. Otherwise, the program will encounter an EOF marker and not process that last line.
2) Tabs, spaces, and commas are all considered whitespace and can be used at any time outside of an explicit command or parameter as per wording of the assignment.
3) It is assumed that if too many parameters are given, an error has been made in input and the line is not executed.
4) If 6 scripts are open and another read command is given, it is ignored and an error message is printed.
5) If an invalid line is found in a script, the CLI will return control to the user after printing an error message.
6) Blank lines are ignored in files.
7) StringTokenizer is used to create the tokens that are parsed for the commands. 

The following are notes about the TIFF-related functions:
1) The TIFF functions assume an integer has 32 bits, a short integer has 16 bits, a character has 8 bits, and a byte has 8 bits for the underlying C++ system (to ISO standard).
2) When a TIFF image is displayed using tiffread, it will not resize the window until the user tries to reshape the window with the mouse (at least on the KNOPPIX boot disk).
3) Tiff_Tag_Names is used to look up names for TIFF tags and must be located in the same directory as main.cpp.

The following are notes about the image zoom/resize functions:
1) In addition to the default filter (Lanczos), Gaussian, Mitchell, Hamming, Hann, and Box filters were also implemented (using the select function). They do not, however, have an optional argument to make them wider.
2) A border command was added that has three options: zero, freeze, and circular, affecting how the program treats pixels that are not in the image.

The following are notes about the 3D transform functions:
1) There is no pause command implemented as part of the CLI.
2) The image is tiffwriteable.

The following are notes about the raytracer:
1) Screen must always be called at least once before any calls to trace.
2) The S parameter has been added to the Triangle and Box commands. The sample image to go along with it is test2.tif (specular boxes are tested in test1.tif). 

Notes about images created for the raytracer portion:
raytrace1.tif (time of creation: 20 seconds): This image contains 3 spheres, a triangle, a box, and two light sources. All objects except the box are behind the screen and are thus only seen by reflection on the box. The script used to create it is called test1.cli.
raytrace2.tif (time of creation: 5-6 seconds): This image contains a triangle and a sphere with the sphere behind the camera and the triangle in front. The script used to create it is called test2.cli.